package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BasePageData;
import com.cskaoyan.bean.BaseParam;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wx.vo.CommmentPostBO;
import com.cskaoyan.bean.wx.vo.WxCommentCountVO;
import com.cskaoyan.bean.wx.vo.WxCommentPageData;
import com.cskaoyan.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author tangjian
 * @Date 2021/10/21 15:52
 * @description
 */
@RestController
@RequestMapping("/wx/comment")
public class WxCommmentController {
    @Autowired
    CommentService commentService;

    @RequestMapping("list")
    public BaseRespVo wxCommentList(String valueId, Integer type, Integer showType, BaseParam baseParam){

        WxCommentPageData basePageData = commentService.queryCommentListByValueIdAndTypeAndshowType(valueId,type,showType,baseParam);

        return BaseRespVo.ok(basePageData);
    }

    @RequestMapping("count")
    public BaseRespVo wxCommentCount(String valueId, Integer type){

        WxCommentCountVO wxCommentCountVO = commentService.countCommentByValueidAndType(valueId,type);

        return BaseRespVo.ok(wxCommentCountVO);
    }

    @RequestMapping("post")
    public BaseRespVo wxCommentPost(@RequestBody CommmentPostBO commmentPostBO){

        int i = commentService.insertComment(commmentPostBO);

        return BaseRespVo.ok();
    }
}
